package risk;

import Conexion.Cliente;

import java.awt.Color;
import java.awt.Dimension;

import java.awt.Font;
import java.awt.Rectangle;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import java.io.IOException;

import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class Tablero1 extends JFrame {
    private JLabel jLabel1 = new JLabel();
    private ImageIcon Ft = new ImageIcon(".//paises//fontable1.jpg");
    private ImageIcon A01 = new ImageIcon(".//paises//cana.jpg");
    private ImageIcon A02 = new ImageIcon(".//paises//colom.jpg");
    private ImageIcon A03 = new ImageIcon(".//paises//fran.jpg");
    private ImageIcon A04 = new ImageIcon(".//paises//chin.jpg");
    private ImageIcon B01 = new ImageIcon(".//paises//usa.jpg");
    private ImageIcon B02 = new ImageIcon(".//paises//bras.jpg");
    private ImageIcon B03 = new ImageIcon(".//paises//suiz.jpg");
    private ImageIcon B04 = new ImageIcon(".//paises//alemania.jpg");
    private ImageIcon C01 = new ImageIcon(".//paises//mex.jpg");
    private ImageIcon C02 = new ImageIcon(".//paises//argen.jpg");
    private ImageIcon C03 = new ImageIcon(".//paises//marr.jpg");
    private ImageIcon C04 = new ImageIcon(".//paises//jama.jpg");
    private ImageIcon D01 = new ImageIcon(".//paises//guat.jpg");
    private ImageIcon D02 = new ImageIcon(".//paises//port.jpg");
    private ImageIcon D03 = new ImageIcon(".//paises//grec.jpg");
    private ImageIcon D04 = new ImageIcon(".//paises//hola.jpg");
    private ImageIcon E01 = new ImageIcon(".//paises//cosric.jpg");
    private ImageIcon E02 = new ImageIcon(".//paises//esp.jpg");
    private ImageIcon E03 = new ImageIcon(".//paises//ita.jpg");
    private ImageIcon E04 = new ImageIcon(".//paises//aust.jpg");
    private ImageIcon dado = new ImageIcon(".//paises//dados.jpg");
    private JButton A1 = new JButton();
    private JButton A2 = new JButton();
    private JButton A3 = new JButton();
    private JButton A4 = new JButton();
    private JButton B1 = new JButton();
    private JButton B2 = new JButton();
    private JButton B3 = new JButton();
    private JButton B4 = new JButton();
    private JButton C1 = new JButton();
    private JButton C2 = new JButton();
    private JButton C3 = new JButton();
    private JButton C4 = new JButton();
    private JButton D1 = new JButton();
    private JButton D2 = new JButton();
    private JButton D3 = new JButton();
    private JButton D4 = new JButton();
    private JButton E1 = new JButton();
    private JButton E2 = new JButton();
    private JButton E3 = new JButton();
    private JButton E4 = new JButton();
    private JButton jButton21 = new JButton();
    private JButton LDados = new JButton();
    private JLabel jLabel2 = new JLabel();
    private JComboBox atak = new JComboBox();
    private JLabel jLabel3 = new JLabel();
    private JComboBox Defen = new JComboBox();
    private JLabel jLabel4 = new JLabel();
    private JLabel jLabel5 = new JLabel();
    private JTextField jTextField1 = new JTextField();
    private JTextField jTextField2 = new JTextField();
    private JLabel jLabel6 = new JLabel();
    private JLabel jLabel7 = new JLabel();
    private JLabel jLabel8 = new JLabel();
    private JLabel jLabel9 = new JLabel();
    private JLabel jLabel10 = new JLabel();
    private JLabel jLabel11 = new JLabel();
    private JLabel jLabel12 = new JLabel();
    private JLabel jLabel13 = new JLabel();
    private JLabel jLabel14 = new JLabel();
    private JLabel jLabel15 = new JLabel();
    private JLabel jLabel16 = new JLabel();
    private JLabel jLabel17 = new JLabel();
    private JLabel jLabel18 = new JLabel();
    private JLabel jLabel19 = new JLabel();
    private JLabel jLabel110 = new JLabel();
    private JLabel jLabel111 = new JLabel();
    private JLabel jLabel112 = new JLabel();
    private JLabel jLabel113 = new JLabel();
    private JLabel jLabel114 = new JLabel();
    private JLabel jLabel115 = new JLabel();
    private JLabel jLabel116 = new JLabel();
    private int fichaspuestas;
    private Cliente servere;
    private Casilla A11;
    private Casilla A21;
    private Casilla A31;
    private Casilla A41;
    private String recepcion;
    private String nn;;

    private Casilla B11;
    private Casilla B21;
    private Casilla B31;
    private Casilla B41;


    private Casilla C11;
    private Casilla C21;
    private Casilla C31;
    private Casilla C41;


    private Casilla D11;
    private Casilla D21;
    private Casilla D31;
    private Casilla D41;


    private Casilla E11;
    private Casilla E21;
    private Casilla E31;
    private Casilla E41;
    private int misPaises;


    /*private ArrayList<Casilla> filaA;
    private ArrayList<Casilla> filaB;
    private ArrayList<Casilla> filaC;
    private ArrayList<Casilla> filaD;
    private ArrayList<Casilla> filaE;
    */

    public Tablero1(Cliente server) {
        servere = server;
        A11 = new Casilla();
        A21 = new Casilla();
        A31 = new Casilla();
        A41 = new Casilla();


        B11 = new Casilla();
        B21 = new Casilla();
        B31 = new Casilla();
        B41 = new Casilla();


        C11 = new Casilla();
        C21 = new Casilla();
        C31 = new Casilla();
        C41 = new Casilla();


        D11 = new Casilla();
        D21 = new Casilla();
        D31 = new Casilla();
        D41 = new Casilla();


        E11 = new Casilla();
        E21 = new Casilla();
        E31 = new Casilla();
        E41 = new Casilla();
        fichaspuestas = 0;


        try {
            jbInit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    void defender() {        
        Random ran1 = new Random();
        int rand1 = ran1.nextInt(6)+1;
        int rand2 = ran1.nextInt(6)+1;  
        //posAtaca, this.servere.Recibir();
    }

    int getDefensas() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    int getMisPaises() {
        return this.misPaises;
    }

    void habilitarBotones() {
        this.LDados.setEnabled(true);
    }

    private void jbInit() throws Exception {
        this.setSize(new Dimension(836, 581));
        this.getContentPane().setLayout(null);
        this.setTitle("**tAbLeRo**");
        jLabel1.setBounds(new Rectangle(0, 0, 835, 550));
        jLabel1.setIcon(Ft);
        A1.setBounds(new Rectangle(50, 40, 75, 63));
        A1.setSize(new Dimension(75, 63));
        A1.setIcon(A01);
        A1.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)   {
                try {
                    A1_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        A2.setBounds(new Rectangle(125, 40, 75, 63));
        A2.setIcon(A02);
        A2.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)  {
                try {
                    A2_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        A3.setBounds(new Rectangle(200, 40, 75, 63));
        A3.setIcon(A03);
        A3.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)  {
                try {
                    A3_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        A4.setBounds(new Rectangle(275, 40, 75, 63));
        A4.setIcon(A04);
        A4.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                try {
                    A4_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        B1.setBounds(new Rectangle(50, 105, 75, 63));
        B1.setIcon(B01);
        B1.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)  {
                try {
                    B1_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        B2.setBounds(new Rectangle(125, 105, 75, 63));
        B2.setIcon(B02);
        B2.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)  {
                try {
                    B2_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        B3.setBounds(new Rectangle(200, 105, 75, 63));
        B3.setIcon(B03);
        B3.setBackground(Color.white);
        B3.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)  {
                try {
                    B3_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        B4.setBounds(new Rectangle(275, 105, 75, 63));
        B4.setIcon(B04);
        B4.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)  {
                try {
                    B4_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        C1.setBounds(new Rectangle(50, 170, 75, 63));
        C1.setIcon(C01);
        C1.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                try {
                    C1_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        C2.setBounds(new Rectangle(125, 170, 75, 63));
        C2.setIcon(C02);
        C2.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                try {
                    C2_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        C3.setBounds(new Rectangle(200, 170, 75, 63));
        C3.setIcon(C03);
        C4.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                try {
                    C4_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        C4.setBounds(new Rectangle(275, 170, 75, 63));
        C4.setIcon(C04);
        D1.setBounds(new Rectangle(50, 235, 75, 63));
        D1.setIcon(D01);
        D1.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)  {
                try {
                    D1_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        D2.setBounds(new Rectangle(125, 235, 75, 63));
        D2.setIcon(D02);
        D2.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)  {
                try {
                    D2_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        D3.setBounds(new Rectangle(200, 235, 75, 63));
        D3.setIcon(D03);
        D3.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)   {
                try {
                    D3_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        D4.setBounds(new Rectangle(275, 235, 75, 63));
        D4.setIcon(D04);
        D4.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)   {
                try {
                    D4_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        E1.setBounds(new Rectangle(50, 300, 75, 63));
        E1.setIcon(E01);
        E1.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)   {
                try {
                    E1_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        E2.setBounds(new Rectangle(125, 300, 75, 63));
        E2.setIcon(E02);
        E2.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)   {
                try {
                    E2_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        E3.setBounds(new Rectangle(200, 300, 75, 63));
        E3.setIcon(E03);
        E3.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)   {
                try {
                    E3_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        E4.setBounds(new Rectangle(275, 300, 75, 63));
        E4.setIcon(E04);
        E4.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)   {
                try {
                    E4_actionPerformed(e);
                } catch (IOException ex) {
                    Logger.getLogger(Tablero1.class.getName()).log(Level.SEVERE, null, ex);
                }
                    }
                });
        jButton21.setText("Salir");
        jButton21.setBounds(new Rectangle(655, 485, 130, 40));
        jButton21.setToolTipText("salir");
        jButton21.setBackground(Color.black);
        jButton21.setFont(new Font("Impact", 0, 15));
        jButton21.setForeground(new Color(231, 231, 0));
        jButton21.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        jButton21_actionPerformed(e);
                    }
                });
        LDados.setBounds(new Rectangle(480, 30, 180, 190));
        LDados.setIcon(dado);
        LDados.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        LDados_actionPerformed(e);
                    }
                });
        jLabel2.setText("Lanzar dados");
        jLabel2.setBounds(new Rectangle(500, 220, 170, 35));
        jLabel2.setFont(new Font("Impact", 0, 18));
        jLabel2.setForeground(Color.white);
        atak.setBounds(new Rectangle(710, 60, 60, 25));
        atak.addItem("1");
        atak.addItem("2");
        atak.addItem("3");
        jLabel3.setText("Ataque");
        jLabel3.setBounds(new Rectangle(710, 35, 75, 15));
        jLabel3.setForeground(Color.white);
        jLabel3.setFont(new Font("Impact", 0, 16));
        Defen.setBounds(new Rectangle(710, 155, 60, 25));
        Defen.addItem("1");
        Defen.addItem("2");
        jLabel4.setText("Defender");
        jLabel4.setBounds(new Rectangle(710, 120, 75, 25));
        jLabel4.setFont(new Font("Impact", 0, 16));
        jLabel4.setForeground(Color.white);
        jLabel5.setText("Resultado rojo");
        jLabel5.setBounds(new Rectangle(610, 290, 125, 30));
        jLabel5.setForeground(Color.red);
        jLabel5.setFont(new Font("Impact", 0, 20));
        jTextField1.setBounds(new Rectangle(550, 295, 45, 25));
        jTextField2.setBounds(new Rectangle(550, 340, 45, 25));
        jLabel6.setText("Resultado blanco");
        jLabel6.setBounds(new Rectangle(610, 335, 150, 30));
        jLabel6.setForeground(Color.white);
        jLabel6.setFont(new Font("Impact", 0, 20));
        jLabel7.setBounds(new Rectangle(100, 40, 25, 20));
        jLabel8.setBounds(new Rectangle(175, 40, 25, 20));
        jLabel9.setBounds(new Rectangle(250, 40, 25, 20));
        jLabel10.setBounds(new Rectangle(325, 40, 25, 20));
        jLabel11.setBounds(new Rectangle(100, 105, 25, 20));
        jLabel12.setBounds(new Rectangle(175, 105, 25, 20));
        jLabel13.setBounds(new Rectangle(250, 105, 25, 20));
        jLabel14.setBounds(new Rectangle(325, 105, 25, 20));
        jLabel15.setBounds(new Rectangle(100, 170, 25, 20));
        jLabel16.setBounds(new Rectangle(175, 170, 25, 20));
        jLabel17.setBounds(new Rectangle(250, 170, 25, 20));
        jLabel18.setBounds(new Rectangle(325, 170, 25, 20));
        jLabel19.setBounds(new Rectangle(100, 235, 25, 20));
        jLabel110.setBounds(new Rectangle(175, 235, 25, 20));
        jLabel111.setBounds(new Rectangle(250, 235, 25, 20));
        jLabel112.setBounds(new Rectangle(325, 235, 25, 20));
        jLabel113.setBounds(new Rectangle(100, 300, 25, 20));
        jLabel114.setBounds(new Rectangle(175, 300, 25, 20));
        jLabel115.setBounds(new Rectangle(250, 300, 25, 20));
        jLabel116.setBounds(new Rectangle(325, 300, 25, 20));
        this.getContentPane().add(jLabel6, null);
        this.getContentPane().add(jTextField2, null);
        this.getContentPane().add(jTextField1, null);
        this.getContentPane().add(jLabel5, null);
        this.getContentPane().add(jLabel4, null);
        this.getContentPane().add(Defen, null);
        this.getContentPane().add(jLabel3, null);
        this.getContentPane().add(atak, null);
        this.getContentPane().add(jLabel2, null);
        this.getContentPane().add(LDados, null);
        this.getContentPane().add(jButton21, null);
        this.getContentPane().add(E4, null);
        this.getContentPane().add(E3, null);
        this.getContentPane().add(E2, null);
        this.getContentPane().add(E1, null);
        this.getContentPane().add(D4, null);
        this.getContentPane().add(D3, null);
        this.getContentPane().add(D2, null);
        this.getContentPane().add(D1, null);
        this.getContentPane().add(C4, null);
        this.getContentPane().add(C3, null);
        this.getContentPane().add(C2, null);
        this.getContentPane().add(C1, null);
        this.getContentPane().add(B4, null);
        this.getContentPane().add(B3, null);
        this.getContentPane().add(B2, null);
        this.getContentPane().add(B1, null);
        this.getContentPane().add(A4, null);
        this.getContentPane().add(A3, null);
        this.getContentPane().add(A2, null);
        this.getContentPane().add(A1, null);
        this.getContentPane().add(jLabel1, null);
    } 

    private void jButton21_actionPerformed(ActionEvent e) {
        System.exit(0);
    }

    private void LDados_actionPerformed(ActionEvent e) {
    }

    private void A1_actionPerformed(ActionEvent e) throws IOException {
        this.A11.setJugador(1);
        this.A11.setnumSoldados();
        this.setFichaspuestas();
        this.servere.EnviarServer("A1");
        this.editarcasilla(this.recepcion);

    }

    private void A2_actionPerformed(ActionEvent e) throws IOException {
        
        this.A21.setJugador(1);
        this.A21.setnumSoldados();
        this.setFichaspuestas();
        /*this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("A21");
        this.editarcasilla(nn);
    }

    private void A3_actionPerformed(ActionEvent e) throws IOException {
        this.A31.setJugador(1);
        this.A31.setnumSoldados();
        this.setFichaspuestas();
/*        this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("A31");
        this.editarcasilla(nn);
    }

    private void A4_actionPerformed(ActionEvent e) throws IOException {
        this.A41.setJugador(1);
        this.A41.setnumSoldados();
        this.setFichaspuestas();
      /*  this.servere.Recibir();
        nn = servere.getLlegada();        */
        this.servere.EnviarServer("A41");
        this.editarcasilla(nn);
    }

    private void B1_actionPerformed(ActionEvent e) throws IOException {
        this.B11.setJugador(1);
        this.B11.setnumSoldados();
        this.setFichaspuestas();
        this.servere.EnviarServer("B11");
        this.editarcasilla(nn);
    }

    private void B2_actionPerformed(ActionEvent e) throws IOException {
        this.B21.setJugador(1);
        this.B21.setnumSoldados();
        this.setFichaspuestas();
        /*this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("B21");
        this.editarcasilla(nn);
    }

    private void B3_actionPerformed(ActionEvent e) throws IOException {
        this.B31.setJugador(1);
        this.B31.setnumSoldados();
        this.setFichaspuestas();
        /*this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("B31");
        this.editarcasilla(nn);
    }

    private void B4_actionPerformed(ActionEvent e) throws IOException {
        this.B41.setJugador(1);
        this.B41.setnumSoldados();
        this.setFichaspuestas();
     /*   this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("B41");
        this.editarcasilla(nn);
    }

    private void C1_actionPerformed(ActionEvent e) throws IOException {
        this.C11.setJugador(1);
        this.C11.setnumSoldados();
        this.setFichaspuestas();
       /* this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("C11");
        this.editarcasilla(nn);
    }

    private void C2_actionPerformed(ActionEvent e) throws IOException {
        this.C21.setJugador(1);
        this.C21.setnumSoldados();
        this.setFichaspuestas();
  /*      this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("C21");
        this.editarcasilla(nn);
    }

    private void C3_actionPerformed(ActionEvent e) throws IOException {
        this.C31.setJugador(1);
        this.C31.setnumSoldados();
        this.setFichaspuestas();
   /*     this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("C31");
        this.editarcasilla(nn);
    }

    private void C4_actionPerformed(ActionEvent e) throws IOException {
        this.C41.setJugador(1);
        this.C41.setnumSoldados();
        this.setFichaspuestas();
     /*   this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("C41");
        this.editarcasilla(nn);
    }

    private void D1_actionPerformed(ActionEvent e) throws IOException {
        this.D11.setJugador(1);
        this.D11.setnumSoldados();
        this.setFichaspuestas();
      /*  this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("D11");
        this.editarcasilla(nn);
    }

    private void D2_actionPerformed(ActionEvent e) throws IOException {
        this.D21.setJugador(1);
        this.D21.setnumSoldados();
        this.setFichaspuestas();
      /*  this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("D21");
        this.editarcasilla(nn);
    }

    private void D3_actionPerformed(ActionEvent e) throws IOException {
        this.D31.setJugador(1);
        this.D31.setnumSoldados();
        this.setFichaspuestas();
      /*  this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("D31");
        this.editarcasilla(nn);
    }

    private void D4_actionPerformed(ActionEvent e) throws IOException {
        this.D41.setJugador(1);
        this.D41.setnumSoldados();
        this.setFichaspuestas();
      /*          this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("D41");
        this.editarcasilla(nn);
    }

    private void E1_actionPerformed(ActionEvent e) throws IOException {
        this.E11.setJugador(1);
        this.E11.setnumSoldados();
        this.setFichaspuestas();
       /* this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("E11");
        this.editarcasilla(nn);
    }

    private void E2_actionPerformed(ActionEvent e) throws IOException {
        this.E21.setJugador(1);
        this.E21.setnumSoldados();
        this.setFichaspuestas();
    /*    this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("E21");
        this.editarcasilla(nn);
    }

    private void E3_actionPerformed(ActionEvent e) throws IOException {
        this.E31.setJugador(1);
        this.E31.setnumSoldados();
        this.setFichaspuestas();
   /*     this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("E31");
        this.editarcasilla(nn);
    }

    private void E4_actionPerformed(ActionEvent e) throws IOException {
        this.E41.setJugador(1);
        this.E41.setnumSoldados();
        this.setFichaspuestas();
       /* this.servere.Recibir();
        nn = servere.getLlegada();*/
        this.servere.EnviarServer("E41");
        this.editarcasilla(nn);
    }   
   


    public void editarcasilla(String casillamodificar) {
        String fila = casillamodificar;
        //int valorFila = Integer.parseInt(fila);
        
        //switch (valorFila) {
        if(fila.compareTo("A11") == 0 ){
            System.out.println("A11");
            A11.setJugador(2);
            A11.setnumSoldados();
            if ( A1.isEnabled() ){ A1.setEnabled(false); this.misPaises++; }
            A1.setEnabled(false);}
        if(fila.compareTo("A21") == 0 ){
            System.out.println("A21");
            A21.setJugador(2);
            A21.setnumSoldados();
            if ( A2.isEnabled() ){ A2.setEnabled(false); this.misPaises++; }
            A2.setEnabled(false);}
        if(fila.compareTo("A31") == 0 ){
            System.out.println("A31");
            A31.setJugador(2);
            A31.setnumSoldados();
            if ( A3.isEnabled() ){ A3.setEnabled(false); this.misPaises++; }
            A3.setEnabled(false);}
        if(fila.compareTo("A41") == 0 ){
            System.out.println("A41");
            A41.setJugador(2);
            A41.setnumSoldados();
            if ( A4.isEnabled() ){ A4.setEnabled(false); this.misPaises++; }
            A4.setEnabled(false);}
        if(fila.compareTo("B11") == 0 ){
            System.out.println("B11");
            B11.setJugador(2);
            B11.setnumSoldados();
            if ( B1.isEnabled() ){ B1.setEnabled(false); this.misPaises++; }
            B1.setEnabled(false);}
        if(fila.compareTo("B21") == 0 ){
            System.out.println("B21");
            B21.setJugador(2);
            B21.setnumSoldados();
            if ( B2.isEnabled() ){ B2.setEnabled(false); this.misPaises++; }
            B2.setEnabled(false);}
        if(fila.compareTo("B31") == 0 ){
            System.out.println("B31");
            B31.setJugador(2);
            B31.setnumSoldados();
            if ( B3.isEnabled() ){ B3.setEnabled(false); this.misPaises++; }
            B3.setEnabled(false);}
        if(fila.compareTo("B41") == 0 ){
            System.out.println("B41");
            B41.setJugador(2);
            B41.setnumSoldados();
            if ( B4.isEnabled() ){ B4.setEnabled(false); this.misPaises++; }
            B4.setEnabled(false);}
        if(fila.compareTo("C11") == 0 ){
            System.out.println("C11");
            C11.setJugador(2);
            C11.setnumSoldados();
            if ( C1.isEnabled() ){ C1.setEnabled(false); this.misPaises++; }
            C1.setEnabled(false);}
        if(fila.compareTo("C21") == 0 ){
            System.out.println("C21");
            C21.setJugador(2);
            C21.setnumSoldados();
            if ( C2.isEnabled() ){ C2.setEnabled(false); this.misPaises++; }
            C2.setEnabled(false);}
        if(fila.compareTo("C31") == 0 ){
            System.out.println("C31");
            C31.setJugador(2);
            C31.setnumSoldados();
            if ( C3.isEnabled() ){ C3.setEnabled(false); this.misPaises++; }
            C3.setEnabled(false);}
        if(fila.compareTo("C41") == 0 ){
            System.out.println("C41");
            C41.setJugador(2);
            C41.setnumSoldados();
            if ( C4.isEnabled() ){ C4.setEnabled(false); this.misPaises++; }
            C4.setEnabled(false);}
        if(fila.compareTo("D11") == 0 ){
            System.out.println("D11");
            D11.setJugador(2);
            D11.setnumSoldados();
            if ( D1.isEnabled() ){ D1.setEnabled(false); this.misPaises++; }
            D1.setEnabled(false);}
        if(fila.compareTo("D21") == 0 ){
            System.out.println("D21");
            D21.setJugador(2);
            D21.setnumSoldados();
            if ( D2.isEnabled() ){ D2.setEnabled(false); this.misPaises++; }
            D2.setEnabled(false);}
        if(fila.compareTo("D31") == 0 ){
            System.out.println("D31");
            D31.setJugador(2);
            D31.setnumSoldados();
            if ( D3.isEnabled() ){ D3.setEnabled(false); this.misPaises++; }
            D3.setEnabled(false);}
        if(fila.compareTo("D41") == 0 ){
            System.out.println("D41");
            D41.setJugador(2);
            D41.setnumSoldados();
            if ( D4.isEnabled() ){ D4.setEnabled(false); this.misPaises++; }
            D4.setEnabled(false);}
        if(fila.compareTo("E11") == 0 ){
            System.out.println("E11");
            E11.setJugador(2);
            E11.setnumSoldados();
            if ( E1.isEnabled() ){ E1.setEnabled(false); this.misPaises++; }
            E1.setEnabled(false);}
        if(fila.compareTo("E21") == 0 ){
            System.out.println("E21");
            E21.setJugador(2);
            E21.setnumSoldados();
            if ( E2.isEnabled() ){ E2.setEnabled(false); this.misPaises++; }
            E2.setEnabled(false);}
        if(fila.compareTo("E31") == 0 ){
            System.out.println("E31");
            E31.setJugador(2);
            E31.setnumSoldados();
            if ( E3.isEnabled() ){ E3.setEnabled(false); this.misPaises++; }
            E3.setEnabled(false);}
        if(fila.compareTo("E41") == 0 ){
            System.out.println("E41");
            E41.setJugador(2);
            E41.setnumSoldados();
            if ( E4.isEnabled() ){ E4.setEnabled(false); this.misPaises++; }
            E4.setEnabled(false);}
        
    }


    public int getFichaspuestas() {
        return fichaspuestas;
    }

    public void setFichaspuestas() {
        this.fichaspuestas++;
    }
    
    
    
}
